﻿#ifndef SPINBOX_H
#define SPINBOX_H

#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QDebug>
#include <QTimer>
#include <QWheelEvent>



class SpinBox : public QSpinBox
{
	Q_OBJECT

private:
	int m_value;
	QTimer* m_timer;

private slots:
	void onTimerTimeout ();

public:
	SpinBox (QWidget * parent = 0);
	void mouseReleaseEvent (QMouseEvent *event);
	void wheelEvent (QWheelEvent *event);

public slots:
	void onValueChanged (const int newValue);
	void onEditingFinished ();
	void setValue (const int val);

signals:
	void changed (int);
};

/***************************************************/

class DoubleSpinBox : public QDoubleSpinBox
{
	Q_OBJECT

private:
	double m_value;
	QTimer* m_timer;

private slots:
	void onTimerTimeout ();

public:
	DoubleSpinBox (QWidget * parent = 0);
	void mouseReleaseEvent (QMouseEvent *event);
	void wheelEvent (QWheelEvent *event);


public slots:
	void onValueChanged (const double);
	void onEditingFinished ();
	void setValue (const double);

signals:
	void changed (double);
};





#endif // SPINBOX_H
